﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:local="clr-namespace:Nav"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <SolidColorBrush
        x:Key="MenuBackground"
        Color="#FFB7DDDE" />

    <SolidColorBrush
        x:Key="MenuItemBorder"
        Color="#FF999BD2" />

    <SolidColorBrush
        x:Key="MenuItemBackground"
        Color="#FFBEC6EA" />

    <LinearGradientBrush
        x:Key="MenuIconContainerBackround"
        EndPoint="0.5,1"
        StartPoint="0.5,0">
        <GradientStop
            Color="#FF5E8488" />
        <GradientStop
            Color="#FF99E1EA"
            Offset="1" />
    </LinearGradientBrush>

    <LinearGradientBrush
        x:Key="MenuBorder"
        EndPoint="0.5,1"
        StartPoint="0.5,0">
        <GradientStop
            Color="#FF14D4EE"
            Offset="0.982" />
        <GradientStop
            Color="#FFFFFFFF"
            Offset="0.018" />
    </LinearGradientBrush>

    <Style
        TargetType="local:NavigationMenu">
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="local:NavigationMenu">

                    <Grid
                        VerticalAlignment="Stretch"
                        HorizontalAlignment="Stretch">

                        <Grid.RowDefinitions>
                            <RowDefinition
                                Height="30" />
                            <RowDefinition
                                Height="30" />
                            <RowDefinition
                                Height="*" />
                        </Grid.RowDefinitions>

                        <Rectangle
                            Fill="{StaticResource MenuBackground}"
                            Grid.Row="0"
                            Grid.RowSpan="3"
                            RadiusY="5"
                            RadiusX="5"
                            HorizontalAlignment="Stretch"
                            StrokeThickness="6"
                            Margin="0"
                            Stroke="{StaticResource MenuBorder}"
                            VerticalAlignment="Stretch" />

                        <Button
                            Grid.Row="0"
                            x:Name="home"
                            Height="20"
                            Width="45"
                            Margin="10,10,0,0"
                            Content="Home"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Top">
                        </Button>

                        <Button
                            Grid.Row="0"
                            x:Name="nextButton"
                            Height="20"
                            Width="31"
                            Margin="0,10,10,0"
                            Content="&gt;&gt;"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Top" />

                        <Grid
                            Background="{StaticResource MenuItemBorder}"
                            Margin="10,3,10,0"
                            VerticalAlignment="Stretch"
                            HorizontalAlignment="Stretch"
                            Grid.Row="1">

                            <Button
                                x:Name="prevButton"
                                Height="20"
                                Width="Auto"
                                Visibility="Collapsed"
                                MinWidth="30"
                                MaxWidth="70"
                                Margin="3"
                                HorizontalAlignment="left"
                                VerticalAlignment="Center" />

                            <TextBlock
                                x:Name="currentMenu"
                                Margin="0"
                                FontWeight="Bold"
                                Foreground="White"
                                Text="Home"
                                VerticalAlignment="Center"
                                HorizontalAlignment="Center">

                            </TextBlock>
                        </Grid>

                        <Canvas
                            Grid.Row="2"
                            x:Name="itemsCanvas"
                            Background="{StaticResource MenuBackground}"
                            Margin="10,3,10,20">

                        </Canvas>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style
        x:Key="NavigationMenuItemDefaultStyle"
        TargetType="local:NavigationMenuItem">
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="local:NavigationMenuItem">

                    <Border
                        BorderThickness="5,5,5,5"
                        CornerRadius="2,2,2,2"
                        Margin="0,0,0,0"
                        Padding="1,1,1,1"
                        BorderBrush="{StaticResource MenuItemBorder}"
                        VerticalAlignment="Top"
                        Height="58"
                        Background="{StaticResource MenuItemBackground}">

                        <Grid
                            Margin="0,0,0,0"
                            VerticalAlignment="Stretch">


                            <Grid.ColumnDefinitions>
                                <ColumnDefinition
                                    Width="41.5" />
                                <ColumnDefinition
                                    Width="*" />
                                <ColumnDefinition
                                    Width="20" />
                            </Grid.ColumnDefinitions>

                            <Border
                                Grid.Column="0"
                                BorderThickness="0"
                                Width="41.5"
                                Background="{StaticResource MenuIconContainerBackround}"
                                HorizontalAlignment="Left">

                                <Image
                                    Source="{Binding Icon}"
                                    VerticalAlignment="Center"
                                    HorizontalAlignment="Center" />
                            </Border>

                            <TextBlock
                                Grid.Column="1"
                                TextWrapping="Wrap"
                                HorizontalAlignment="Left"
                                Width="Auto"
                                VerticalAlignment="Center"
                                Margin="3,3,3,3"
                                Text="{Binding Name}" />

                            <TextBlock
                                Grid.Column="2"
                                TextWrapping="NoWrap"
                                HorizontalAlignment="Center"
                                Width="Auto"
                                Margin="3,3,3,3"
                                Visibility="{Binding NextLevelVisibility}"
                                VerticalAlignment="Center"
                                Text=">" />

                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style
        TargetType="local:NavigationMenuBand">
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="local:NavigationMenuBand">

                    <ItemsControl
                        x:Name="itemControl"
                        VerticalAlignment="Stretch"
                        HorizontalAlignment="Stretch">

                        <ItemsControl.Template>

                            <ControlTemplate
                                TargetType="ItemsControl">

                                <ScrollViewer
                                    Padding="0"
                                    BorderThickness="0,0,0,0"
                                    VerticalScrollBarVisibility="Auto">
                                    <ItemsPresenter />
                                </ScrollViewer>

                            </ControlTemplate>

                        </ItemsControl.Template>

                        <ItemsControl.ItemsPanel>

                            <ItemsPanelTemplate>
                                <StackPanel
                                    Orientation="Vertical" />
                            </ItemsPanelTemplate>

                        </ItemsControl.ItemsPanel>


                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <local:NavigationMenuItem
                                    Margin="0,0,0,2"
                                    Style="{StaticResource NavigationMenuItemDefaultStyle}">

                                </local:NavigationMenuItem>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>

                    </ItemsControl>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>